package coroutines.thread

import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.*

class Coroutine1000Test {
}

fun main()  {
    val df = SimpleDateFormat("yyyy-MM-dd HH:mm:ss:mmm") //设置日期格式

    GlobalScope.launch {
        repeat(1000) { i ->
            delay(500L)

            println("${df.format(Date())} I'm sleeping $i ..., , ${Thread.currentThread().name}")
        }
    }

    Thread.sleep(100000)
}